 
package com.ymatou.iapi.sellerproduct.testcase;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.livemanage.service.CreateLiveCall;
import com.ymatou.iapi.sellerproduct.parameter.ProdTplBean;
import com.ymatou.iapi.sellerproduct.service.ChangeNewProductInfoCall;
import com.ymatou.iapi.sellerproduct.service.SaveProductTemplateCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.LiveCallService;
import com.ymttest.business.service.NewJavaMongoCheckService;
import com.ymttest.business.service.SellerProductCallService;
import com.ymttest.database.model.YmtProductsI;
import com.ymttest.database.mongo.YmtMongoDriverFactroy;
import com.ymttest.database.mongo.jproduct.LiveProductsWapper;
import com.ymttest.database.sqlwapper.YmtCatalogsIWapper;
import com.ymttest.database.sqlwapper.YmtProductsIWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.JsonBeanHelper;
import com.ymttest.utils.MapUtil;
import com.ymttest.utils.YMTDateUtil;
/**
*修改商品信息
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_ChangeNewProductInfo{
	private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
	private static SimpleDateFormat sdfForName = new SimpleDateFormat("MM-dd HH:mm:ss");
	public static SimpleDateFormat liveSDF = YMTDateUtil.getYMDHMSFormat();
	private static ChangeNewProductInfoCall changenewproductinfoCall = new ChangeNewProductInfoCall();
	private static String sellerName = EnvSetup.getData("productsellername");
	private static int sellerId = Integer.parseInt(EnvSetup.getData("productsellerid"));
	
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("修改商品信息");
	}

	@Before
	public void caseUp() {
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(changenewproductinfoCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_ChangeNewProductInfo_001() {
		Logger.start(true,"修改商品信息 - 现货商品");
		try {
			//add a new product not on sale
			String productId = SellerProductCallService.addNewProductNotOnSale(sellerId, sellerName, MapUtil.hashMap("Product->IsNew",false)).getJSONObject("Data").getString("ProductID");
			
			
			
			//获取规格
			String catalogsId = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).get(0).getsCatalogId();
			
			
			//新品检查
			SellerProductCallService.checkListingTime(productId, YMTDateUtil.parseDate("2099-12-31 00:00:00.000", YMTDateUtil.YMDHMSS));
			
			
			//modify product and on sale 
			Map<String, Object> updateMap = MapUtil.hashMap("LoginID", sellerName, "UserID", sellerId,
															"Product->sProductId",productId,"ProductID",productId,
															"Product->OnSaleType",0,	// 在售类型    Old = -1,  Immediately = 0,    SpecialTime = 1,   OffSale = 2,
															"Product->Catalogs[2]->CatalogId",catalogsId);
			
			String fileName = "changenewproductinfocalltpl_001.json";
			JSONObject responseBean = changenewproductinfoCall.callAndGetReturnData(fileName,updateMap);
			Logger.verifyEquals(200, responseBean.getInt("Code"), "响应报文-返回码");

			JSONObject requsetBean = responseBean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			
			
			
			//检查首次露出时间
			SellerProductCallService.checkListingTime(productId, YMTDateUtil.getDate());
			
			
			changenewproductinfoCall.checkSQLAndMongo_ModifyProduct(requsetBean);
			

			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productId);
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_ChangeNewProductInfo_002() {
		Logger.start(true,"修改商品信息 - FBX商品");
		try {
			
			Map<String, Object> map = new HashMap<String, Object>();			
			map.put("UserID", sellerId);
			map.put("LoginID", sellerName);			
			map.put("Product->OnSaleType", 0);
			map.put("Product->ProductName", "（假）自动化测试_立即上架商品 " + YMTDateUtil.getSysTime());
			map.put("Product->IsNew", true);
			map.put("Product->TariffType", 0);
			
			//add a new product not on sale
			String productId = SellerProductCallService.addFBXProduct(map);						
			
			//获取规格
			String catalogsId = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).get(0).getsCatalogId();				
			
			YMTDateUtil.waitTime(1);
			
			//modify product and on sale 
			Map<String, Object> updateMap = MapUtil.hashMap("LoginID", sellerName, "UserID", sellerId,
															"Product->sProductId",productId,"ProductID",productId,
															"Product->OnSaleType",0,	// 在售类型    Old = -1,  Immediately = 0,    SpecialTime = 1,   OffSale = 2,
															"Product->Catalogs[0]->CatalogId",catalogsId
															);
			
			String fileName = "changenewproductinfocalltpl_002.json";
			JSONObject responseBean = changenewproductinfoCall.callAndGetReturnData(fileName,updateMap);
			Logger.verifyEquals(200, responseBean.getInt("Code"), "响应报文-返回码");

			JSONObject requsetBean = responseBean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
							
			
			//检查首次露出时间
			SellerProductCallService.checkListingTime(productId, YMTDateUtil.getDate());
			
			//sql & mongo 断言
			changenewproductinfoCall.checkSQLAndMongo_ModifyProduct(requsetBean);
			

			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productId);
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}	
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_ChangeNewProductInfo_003() {
		Logger.start(true,"修改商品信息 - 直播商品");
		try {
			
			
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}	
	

	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_ChangeNewProductInfo_004() {
		Logger.start(true,"修改名称、描述信息");
		try {
			//add a new product not on sale
			String productId = SellerProductCallService.addNewProductNotOnSale(sellerId, sellerName, MapUtil.hashMap("Product->IsNew",false)).getJSONObject("Data").getString("ProductID");
			
			
			
			//获取规格
			String catalogsId = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).get(0).getsCatalogId();
						

			//modify product and on sale 
			Map<String, Object> updateMap = MapUtil.hashMap("LoginID", sellerName, "UserID", sellerId,
															"Product->sProductId",productId,"ProductID",productId,
															"Product->Catalogs[2]->CatalogId",catalogsId,
															"Product->MobileDescription","PC端修改商品",
															"Product->ProductName","PC端修改商品名称",
															"Product->ProductDescriptionInfo->WordContent","修改过商品描述",
															"Product->ProductDescriptionInfo->Pictures[0]->PictureUrl","http://pc1.img.ymatou.com/G01/shangou/M00/2C/A9/rBBlD1gAf_2AQ4GrAANhqAY9_CQ541_1_1_n_w_o.jpg");
			
			String fileName = "changenewproductinfocalltpl_001.json";
			JSONObject responseBean = changenewproductinfoCall.callAndGetReturnData(fileName,updateMap);
			Logger.verifyEquals(200, responseBean.getInt("Code"), "响应报文-返回码");

			JSONObject requsetBean = responseBean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			
			
			//检查首次露出时间
			SellerProductCallService.checkListingTime(productId, YMTDateUtil.parseDate("2099-12-31 00:00:00.000", YMTDateUtil.YMDHMSS));
			
			
			changenewproductinfoCall.checkSQLAndMongo_ModifyProduct(requsetBean);
			

			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productId);
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_ChangeNewProductInfo_005() {
		Logger.start(true,"修改商品 - 新增规格图片");
		try {
			//add a new product not on sale
			String productId = SellerProductCallService.addNewProductNotOnSale(sellerId, sellerName, MapUtil.hashMap("Product->IsNew",false)).getJSONObject("Data").getString("ProductID");
			
			
			
			//获取规格
			String catalogsId = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).get(0).getsCatalogId();
						

			//修改商品 - 新增商品规格图标
			Map<String, Object> updateMap = MapUtil.hashMap("LoginID", sellerName, "UserID", sellerId,
															"Product->sProductId",productId,"ProductID",productId,
															"Product->Catalogs[2]->CatalogId",catalogsId,
															"Product->Catalogs[0]->PropertyValues[0]->PropertyValues[0]->AttributeUrl","http://pc1.img.ymatou.com/G01/shangou/M00/2C/A9/rBBlD1gAf_2AQ4GrAANhqAY9_CQ541_1_1_n_w_o1.jpg",
															"Product->Catalogs[0]->PropertyValues[1]->PropertyValues[0]->AttributeUrl","http://pc1.img.ymatou.com/G01/shangou/M00/2C/A9/rBBlD1gAf_2AQ4GrAANhqAY9_CQ541_1_1_n_w_o2.jpg",
															"Product->Catalogs[1]->PropertyValues[0]->PropertyValues[0]->AttributeUrl","http://pc1.img.ymatou.com/G01/shangou/M00/2C/A9/rBBlD1gAf_2AQ4GrAANhqAY9_CQ541_1_1_n_w_o3.jpg",
															"Product->Catalogs[1]->PropertyValues[1]->PropertyValues[0]->AttributeUrl","http://pc1.img.ymatou.com/G01/shangou/M00/2C/A9/rBBlD1gAf_2AQ4GrAANhqAY9_CQ541_1_1_n_w_o4.jpg");
			
			String fileName = "changenewproductinfocalltpl_001.json";
			JSONObject responseBean = changenewproductinfoCall.callAndGetReturnData(fileName,updateMap);
			Logger.verifyEquals(200, responseBean.getInt("Code"), "响应报文-返回码");

			JSONObject requsetBean = responseBean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			
			
			//检查首次露出时间
			SellerProductCallService.checkListingTime(productId, YMTDateUtil.parseDate("2099-12-31 00:00:00.000", YMTDateUtil.YMDHMSS));
			
			
			changenewproductinfoCall.checkSQLAndMongo_ModifyProduct(requsetBean);
			

			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productId);
			}
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}


	@Test
	@Category({P1.class})
	@TestCase
	//首次时间已过，编辑商品时立即上架，首次lisitngtime时间不变
	public void Tc_ChangeNewProductInfo_006() {
		Logger.start(true,"修改商品为立即上架，listingtime不变");
		try{
			//发布一个立即上架商品
			String productid = SellerProductCallService.addNewProductOnSale(sellerId, sellerName, MapUtil.hashMap("Product->ProductName", "hl发布商品","Product->IsNew",false)).getJSONObject("Data").getString("ProductID");
			System.out.println(productid);
			//获取规格id
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productid).get(0).getsCatalogId();
			System.out.println(catalogid);
			//修改商品信息改为立即上架
			Map<String, Object> updatemap = new HashMap<String, Object>();
			updatemap.put("Product->sProductId", productid);
			updatemap.put("ProductID", productid);
			updatemap.put("LoginID", sellerName);
			updatemap.put("UserID", sellerId);
			updatemap.put("Product->OnSaleType", 0);
			updatemap.put("Product->Catalogs[0]->CatalogId",catalogid);
			
			//String fileName = "changenewproductinfocalltpl_003.json";
			JSONObject responseBean = changenewproductinfoCall.callAndGetReturnData(updatemap);
			Logger.debug(responseBean);
			Logger.verifyEquals(200,responseBean.getInt("Code"),"响应返回报文");
			JSONObject requsetBean = responseBean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			
			//检查sql首次漏出时间
			SellerProductCallService.checkSqlListingTime(productid,1);
			//检查mongo首次漏出时间
			YmtProductsI ymtProductsI = new YmtProductsIWapper().selectProductByProductId(productid).get(0);
			Date addtime = ymtProductsI.getdAddTime();
			SellerProductCallService.checkListingTime(productid, addtime);
			
			

			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productid);
			}
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}
	

	@Test
	@Category({P1.class})
	@TestCase
	//首次时间未过，编辑商品时立即上架，首次lisitngtime为上架时间
	public void Tc_ChangeNewProductInfo_007() {
		Logger.start(true,"修改商品为立即上架，listingtime为ValidStart");
		try{ 
			//发布一个定时上架商品
			String productid = SellerProductCallService.addNewProductOnTime(sellerId, sellerName, MapUtil.hashMap("Product->ProductName", "hl发布商品","Product->IsNew",false)).getJSONObject("Data").getString("ProductID");
			System.out.println(productid);
			//获取规格id
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productid).get(0).getsCatalogId();
			System.out.println(catalogid);
			//修改商品信息改为立即上架
			Map<String, Object> updatemap = new HashMap<String, Object>();
			updatemap.put("Product->sProductId", productid);
			updatemap.put("ProductID", productid);
			updatemap.put("LoginID", sellerName);
			updatemap.put("UserID", sellerId);
			updatemap.put("Product->OnSaleType", 0);
			updatemap.put("Product->Catalogs[0]->CatalogId",catalogid);
			
			//String fileName = "changenewproductinfocalltpl_003.json";
			JSONObject responseBean = changenewproductinfoCall.callAndGetReturnData(updatemap);
			Logger.debug(responseBean);
			Logger.verifyEquals(200,responseBean.getInt("Code"),"响应返回报文");
			JSONObject requsetBean = responseBean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			
			//检查sql首次漏出时间
			SellerProductCallService.checkSqlListingTime(productid,2);
			//检查mongo首次漏出时间
/*			YmtProductsI ymtProductsI = new YmtProductsIWapper().selectProductByProductId(productid).get(0);
			Date addtime = ymtProductsI.getdAddTime();*/
			SellerProductCallService.checkListingTime(productid,null);
			
			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productid);
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}

	@Test
	@Category({P1.class})
	@TestCase
	//首次时间未过，五天后上架商品，编辑商品为4天后上架，listingtime为ValidStart时间
	public void Tc_ChangeNewProductInfo_008() {
		Logger.start(true,"修改商品为定时上架（提前），listingtime为ValidStart");
		try{ 
			//发布一个定时上架商品5天后上架
			String productid = SellerProductCallService.addNewProductOnTime(sellerId, sellerName, MapUtil.hashMap("Product->ProductName", "hl发布商品","Product->IsNew",false)).getJSONObject("Data").getString("ProductID");
			System.out.println(productid);
			//获取规格id
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productid).get(0).getsCatalogId();
			System.out.println(catalogid);
			//修改商品信息改为4天后上架
			Map<String, Object> updatemap = new HashMap<String, Object>();
			Calendar c = Calendar.getInstance();
			c.add(Calendar.DAY_OF_MONTH, 4);
			updatemap.put("Product->ValidStart",sdf.format(c.getTime()));
			
			c.add(Calendar.DAY_OF_MONTH, 12);
			updatemap.put("Product->ValidEnd",sdf.format(c.getTime()));
			
			updatemap.put("Product->sProductId", productid);
			updatemap.put("ProductID", productid);
			updatemap.put("LoginID", sellerName);
			updatemap.put("UserID", sellerId);
			updatemap.put("Product->OnSaleType", 1);
			updatemap.put("Product->Catalogs[0]->CatalogId",catalogid);
			
			JSONObject responseBean = changenewproductinfoCall.callAndGetReturnData(updatemap);
			Logger.debug(responseBean);
			Logger.verifyEquals(200,responseBean.getInt("Code"),"响应返回报文");
			JSONObject requsetBean = responseBean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			
			//检查sql首次漏出时间
			SellerProductCallService.checkSqlListingTime(productid,2);
			//检查mongo首次漏出时间

			SellerProductCallService.checkListingTime(productid,null);
			
			
			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productid);
			}
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}

	@Test
	@Category({P1.class})
	@TestCase
	//首次时间未过，5天后上架商品，编辑商品为10天后上架，listingtime为ValidStart时间
	public void Tc_ChangeNewProductInfo_009() {
		Logger.start(true,"修改商品为立即上架，listingtime为ValidStart");
		try{ 
			//发布一个定时上架商品5天后上架
			String productid = SellerProductCallService.addNewProductOnTime(sellerId, sellerName, MapUtil.hashMap("Product->ProductName", "hl发布商品","Product->IsNew",false)).getJSONObject("Data").getString("ProductID");
			System.out.println(productid);
			//获取规格id
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productid).get(0).getsCatalogId();
			System.out.println(catalogid);
			//修改商品信息改为10天后上架
			Map<String, Object> updatemap = new HashMap<String, Object>();
			Calendar c = Calendar.getInstance();
			c.add(Calendar.DAY_OF_MONTH, 10);
			updatemap.put("Product->ValidStart",sdf.format(c.getTime()));
			
			c.add(Calendar.DAY_OF_MONTH, 17);
			updatemap.put("Product->ValidEnd",sdf.format(c.getTime()));
			
			updatemap.put("Product->sProductId", productid);
			updatemap.put("ProductID", productid);
			updatemap.put("LoginID", sellerName);
			updatemap.put("UserID", sellerId);
			updatemap.put("Product->OnSaleType", 1);
			updatemap.put("Product->Catalogs[0]->CatalogId",catalogid);
			
			JSONObject responseBean = changenewproductinfoCall.callAndGetReturnData(updatemap);
			Logger.debug(responseBean);
			Logger.verifyEquals(200,responseBean.getInt("Code"),"响应返回报文");
			JSONObject requsetBean = responseBean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			
			//检查sql首次漏出时间
			SellerProductCallService.checkSqlListingTime(productid,2);
			//检查mongo首次漏出时间

			SellerProductCallService.checkListingTime(productid,null);
			
			
			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productid);
			}
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}

	@Test
	@Category({P1.class})
	@TestCase
	//首次时间未过，商品加入2个未开始的直播，直播Atime<直播Btime<定时上架time，listingtime为直播A时间
	public void Tc_ChangeNewProductInfo_010() {
		Logger.start(true,"商品加入2个未开始的直播，直播Atime<直播Btime<定时上架time");
		try{ 
			//清空10天内的直播
			LiveCallService.updateLiveDateAsBefore(sellerId);
			//创建6天之后的直播
			Integer activityid1 = LiveCallService.createLiveBegin6dayInFuture(sellerName, sellerId).getJSONObject("Data").getInt("ActivityId");
			//创建8天后的直播
			Calendar c = Calendar.getInstance();
			Map<String, Object> updateMap = new HashMap<String,Object>();
			
			updateMap.put("ActivityRequest->SellerName", sellerName);
			updateMap.put("ActivityRequest->UserId", sellerId);
			updateMap.put("ActivityRequest->AppConfirmed", 1);
			updateMap.put("ActivityRequest->ActivityName", "自动化_即将开始直播");
			
			c.add(Calendar.DAY_OF_MONTH, 8);
			updateMap.put("ActivityRequest->StartTime", liveSDF.format(c.getTime()));
			c.add(Calendar.HOUR, 2);
			updateMap.put("ActivityRequest->EndTime", liveSDF.format(c.getTime()));
			
			Integer activityid2 = new CreateLiveCall().callAndGetReturnData(updateMap).getJSONObject("Data").getInt("ActivityId");
			Logger.debug(activityid1);
			Logger.debug(activityid2);
			//添加不上架的商品并加入直播1、直播2
			Map<String, Object> map = new HashMap<String, Object>();
			
			List<Integer> list = new ArrayList<>();
			list.add(activityid1);
			list.add(activityid2);
			
			map.put("UserID", sellerId);
			map.put("LoginID", sellerName);			
			map.put("Product->OnSaleType", 2);
			map.put("Product->ProductName", "hl自动化测试_定时上架商品 "+sdfForName.format(Calendar.getInstance().getTime()));
			map.put("Product->LiveIdList",new JSONArray(list));

			//获取商品ID
			String productid = SellerProductCallService.addNewProductNotOnSale(sellerId, sellerName, map).getJSONObject("Data").getString("ProductID");
			//String productid = new AddNewSellerProductCall().callAndGetReturnData(map).getJSONObject("Data").getString("ProductID");
			//获取规格ID
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productid).get(0).getsCatalogId();
			//编辑商品为10天后上架的商品
			Map <String,Object> changemap = new HashMap<String, Object>();
			Calendar p = Calendar.getInstance();
			p.add(Calendar.DAY_OF_MONTH, 10);
			changemap.put("Product->ValidStart",sdf.format(p.getTime()));
			Logger.debug(sdf.format(c.getTime()));
			p.add(Calendar.DAY_OF_MONTH, 17);
			changemap.put("Product->ValidEnd",sdf.format(p.getTime()));
			Logger.debug(sdf.format(c.getTime()));
			changemap.put("Product->OnSaleType", 1);
			changemap.put("Product->Catalogs[0]->CatalogId",catalogid);
			changemap.put("LoginID", sellerName);
			changemap.put("UserID", sellerId);
			changemap.put("Product->sProductId", productid);
			changemap.put("ProductID", productid);
			
			JSONObject responbean = changenewproductinfoCall.callAndGetReturnData(changemap);
			Logger.verifyEquals(200, responbean.getInt("Code"), "接口返回200");
			JSONObject requestbean = responbean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			//检查sql首次露出时间
			SellerProductCallService.checkSqlListingTime(productid, 3);
			//检查mongo首次露出时间
			SellerProductCallService.checkListingTime(productid, null);
			
			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				Logger.verifyEquals(2, new LiveProductsWapper().getCountByProductId(productid), "Mongo-LiveProducts 检查直播商品数量");
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productid);
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	//首次时间未过，商品加入2个未开始的直播，定时上架time<直播Atime<直播Btime，listingtime为定时上架time
	public void Tc_ChangeNewProductInfo_011() {
		Logger.start(true,"商品加入2个未开始的直播，定时上架time<直播Atime<直播Btime");
		try{ 
			//清空10天内的直播
			LiveCallService.updateLiveDateAsBefore(sellerId);
			//创建6天之后的直播
			Integer activityid1 = LiveCallService.createLiveBegin6dayInFuture(sellerName, sellerId).getJSONObject("Data").getInt("ActivityId");
			//创建8天后的直播
			Calendar c = Calendar.getInstance();
			Map<String, Object> updateMap = new HashMap<String,Object>();
			
			updateMap.put("ActivityRequest->SellerName", sellerName);
			updateMap.put("ActivityRequest->UserId", sellerId);
			updateMap.put("ActivityRequest->AppConfirmed", 1);
			updateMap.put("ActivityRequest->ActivityName", "自动化_即将开始直播");
			
			c.add(Calendar.DAY_OF_MONTH, 8);
			updateMap.put("ActivityRequest->StartTime", liveSDF.format(c.getTime()));
			c.add(Calendar.HOUR, 2);
			updateMap.put("ActivityRequest->EndTime", liveSDF.format(c.getTime()));
			
			Integer activityid2 = new CreateLiveCall().callAndGetReturnData(updateMap).getJSONObject("Data").getInt("ActivityId");
			Logger.debug(activityid1);
			Logger.debug(activityid2);
			//添加不上架的商品并加入直播1、直播2
			Map<String, Object> map = new HashMap<String, Object>();
			
			List<Integer> list = new ArrayList<>();
			list.add(activityid1);
			list.add(activityid2);
			
			map.put("UserID", sellerId);
			map.put("LoginID", sellerName);			
			map.put("Product->OnSaleType", 2);
			map.put("Product->ProductName", "hl自动化测试_定时上架商品 "+sdfForName.format(Calendar.getInstance().getTime()));
			map.put("Product->LiveIdList",new JSONArray(list));

			//获取商品ID
			String productid = SellerProductCallService.addNewProductNotOnSale(sellerId, sellerName, map).getJSONObject("Data").getString("ProductID");
			
			//获取规格ID
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productid).get(0).getsCatalogId();
			//编辑商品为4天后上架的商品
			Map <String,Object> changemap = new HashMap<String, Object>();
			Calendar p = Calendar.getInstance();
			p.add(Calendar.DAY_OF_MONTH, 4);
			changemap.put("Product->ValidStart",sdf.format(p.getTime()));
			
			p.add(Calendar.DAY_OF_MONTH, 11);
			changemap.put("Product->ValidEnd",sdf.format(p.getTime()));
			
			changemap.put("Product->OnSaleType", 1);
			changemap.put("Product->Catalogs[0]->CatalogId",catalogid);
			changemap.put("LoginID", sellerName);
			changemap.put("UserID", sellerId);
			changemap.put("Product->sProductId", productid);
			changemap.put("ProductID", productid);
			
			JSONObject responbean = changenewproductinfoCall.callAndGetReturnData(changemap);
			Logger.verifyEquals(200, responbean.getInt("Code"), "接口返回200");
			JSONObject requestbean = responbean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			//检查sql首次露出时间
			SellerProductCallService.checkSqlListingTime(productid, 2);
			//检查mongo首次露出时间
			SellerProductCallService.checkListingTime(productid, null);
			
			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productid);
			}
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	//首次时间未过，商品加入2个未开始的直播，直播Atime<定时上架time<直播Btime，listingtime为直播A时间
	public void Tc_ChangeNewProductInfo_012() {
		Logger.start(true,"商品加入2个未开始的直播，直播Atime<定时上架time<直播Btime");
		try{ 
			//清空10天内的直播
			LiveCallService.updateLiveDateAsBefore(sellerId);
			//创建6天之后的直播
			Integer activityid1 = LiveCallService.createLiveBegin6dayInFuture(sellerName, sellerId).getJSONObject("Data").getInt("ActivityId");
			//创建8天后的直播
			Calendar c = Calendar.getInstance();
			Map<String, Object> updateMap = new HashMap<String,Object>();
			
			updateMap.put("ActivityRequest->SellerName", sellerName);
			updateMap.put("ActivityRequest->UserId", sellerId);
			updateMap.put("ActivityRequest->AppConfirmed", 1);
			updateMap.put("ActivityRequest->ActivityName", "自动化_即将开始直播");
			
			c.add(Calendar.DAY_OF_MONTH, 8);
			updateMap.put("ActivityRequest->StartTime", liveSDF.format(c.getTime()));
			c.add(Calendar.HOUR, 2);
			updateMap.put("ActivityRequest->EndTime", liveSDF.format(c.getTime()));
			
			Integer activityid2 = new CreateLiveCall().callAndGetReturnData(updateMap).getJSONObject("Data").getInt("ActivityId");
			Logger.debug(activityid1);
			Logger.debug(activityid2);
			//添加不上架的商品并加入直播1、直播2
			Map<String, Object> map = new HashMap<String, Object>();
			
			List<Integer> list = new ArrayList<>();
			list.add(activityid1);
			list.add(activityid2);
			
			map.put("UserID", sellerId);
			map.put("LoginID", sellerName);			
			map.put("Product->OnSaleType", 2);
			map.put("Product->ProductName", "hl自动化测试_定时上架商品 "+sdfForName.format(Calendar.getInstance().getTime()));
			map.put("Product->LiveIdList",new JSONArray(list));

			//获取商品ID
			String productid = SellerProductCallService.addNewProductNotOnSale(sellerId, sellerName, map).getJSONObject("Data").getString("ProductID");
			
			//获取规格ID
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productid).get(0).getsCatalogId();
			//编辑商品为4天后上架的商品
			Map <String,Object> changemap = new HashMap<String, Object>();
			Calendar p = Calendar.getInstance();
			p.add(Calendar.DAY_OF_MONTH, 7);
			changemap.put("Product->ValidStart",sdf.format(p.getTime()));
			
			p.add(Calendar.DAY_OF_MONTH, 14);
			changemap.put("Product->ValidEnd",sdf.format(p.getTime()));
			
			changemap.put("Product->OnSaleType", 1);
			changemap.put("Product->Catalogs[0]->CatalogId",catalogid);
			changemap.put("LoginID", sellerName);
			changemap.put("UserID", sellerId);
			changemap.put("Product->sProductId", productid);
			changemap.put("ProductID", productid);
			
			JSONObject responbean = changenewproductinfoCall.callAndGetReturnData(changemap);
			Logger.verifyEquals(200, responbean.getInt("Code"), "接口返回200");
			JSONObject requestbean = responbean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			//检查sql首次露出时间
			SellerProductCallService.checkSqlListingTime(productid,3);
			//检查mongo首次露出时间
			SellerProductCallService.checkListingTime(productid, null);
			
			
			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productid);
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}
	@Test
	@Category({P1.class})
	@TestCase
	//发布一个5天后定时上架商品，编辑商品为不上架，listingtime=2099
	public void Tc_ChangeNewProductInfo_013() {
		Logger.start(true,"发布一个5天后定时上架商品，编辑商品为不上架，listingtime=2099");
		try{
			//发布一个5天后上架的商品
			String productid = SellerProductCallService.addNewProductOnTime(sellerId, sellerName, null).getJSONObject("Data").getString("ProductID");
			//获取规格ID
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productid).get(0).getsCatalogId();
			//修改商品为下架状态
			Map<String, Object> updatemap = new HashMap<String, Object>();
			updatemap.put("Product->sProductId", productid);
			updatemap.put("ProductID", productid);
			updatemap.put("LoginID", sellerName);
			updatemap.put("UserID", sellerId);
			updatemap.put("Product->OnSaleType", 2);
			updatemap.put("Product->Catalogs[0]->CatalogId",catalogid);
			
			JSONObject responbean = changenewproductinfoCall.callAndGetReturnData(updatemap);
			Logger.verifyEquals(200, responbean.getInt("Code"),"接口返回200");
			JSONObject requestbean = responbean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			//检查sql首次露出时间
			SellerProductCallService.checkSqlListingTime(productid, 4);
			//检查sql首次露出时间
			SellerProductCallService.checkListingTime(productid, null);
			
			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productid);
			}
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}
	@Test
	@Category({P1.class})
	@TestCase
	//发布一个不上架商品，编辑商品为不上架，listingtime=2099
	public void Tc_ChangeNewProductInfo_014() {
		Logger.start(true,"发布一个不上架商品，编辑商品为不上架，listingtime=2099");
		try{
			//发布一个5天后上架的商品
			String productid = SellerProductCallService.addNewProductNotOnSale(sellerId, sellerName, null).getJSONObject("Data").getString("ProductID");
			//获取规格ID
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productid).get(0).getsCatalogId();
			//修改商品为下架状态
			Map<String, Object> updatemap = new HashMap<String, Object>();
			updatemap.put("Product->sProductId", productid);
			updatemap.put("ProductID", productid);
			updatemap.put("LoginID", sellerName);
			updatemap.put("UserID", sellerId);
			updatemap.put("Product->OnSaleType", 2);
			updatemap.put("Product->Catalogs[0]->CatalogId",catalogid);
			
			JSONObject responbean = changenewproductinfoCall.callAndGetReturnData(updatemap);
			Logger.verifyEquals(200, responbean.getInt("Code"),"接口返回200");
			JSONObject requestbean = responbean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			//检查sql首次露出时间
			SellerProductCallService.checkSqlListingTime(productid, 4);
			//检查sql首次露出时间
			SellerProductCallService.checkListingTime(productid, null);
			
			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productid);
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}

	@Test
	@Category({P1.class})
	@TestCase
	//发布一个不上架商品，关联未开始的直播，编辑商品为不上架，listingtime=直播开始时间
	public void Tc_ChangeNewProductInfo_015() {
		Logger.start(true,"发布一个不上架商品，关联未开始的直播，编辑商品为不上架，listingtime=直播开始时间");
		try{
		
			//创建6天之后的直播
			Integer activityid1 = LiveCallService.createLiveBegin6dayInFuture(sellerName, sellerId).getJSONObject("Data").getInt("ActivityId");

			//添加不上架的商品并加入直播
			Map<String, Object> map = new HashMap<String, Object>();
			
			List<Integer> list = new ArrayList<>();
			list.add(activityid1);
			
			map.put("UserID", sellerId);
			map.put("LoginID", sellerName);			
			map.put("Product->OnSaleType", 2);
			map.put("Product->ProductName", "hl自动化测试_定时上架商品 "+sdfForName.format(Calendar.getInstance().getTime()));
			map.put("Product->LiveIdList",new JSONArray(list));

			//获取商品ID
			String productid = SellerProductCallService.addNewProductNotOnSale(sellerId, sellerName, map).getJSONObject("Data").getString("ProductID");
			
			//获取规格ID
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productid).get(0).getsCatalogId();
			//修改商品为下架状态
			Map<String, Object> updatemap = new HashMap<String, Object>();
			updatemap.put("Product->sProductId", productid);
			updatemap.put("ProductID", productid);
			updatemap.put("LoginID", sellerName);
			updatemap.put("UserID", sellerId);
			updatemap.put("Product->OnSaleType", 2);
			updatemap.put("Product->Catalogs[0]->CatalogId",catalogid);
			
			JSONObject responbean = changenewproductinfoCall.callAndGetReturnData(updatemap);
			Logger.verifyEquals(200, responbean.getInt("Code"), "接口返回200");
			JSONObject requestbean = responbean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			//检查sql首次露出时间
			SellerProductCallService.checkSqlListingTime(productid,3);
			//检查mongo首次露出时间
			SellerProductCallService.checkListingTime(productid, null);
			
			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productid);
			}
			
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	//发布一个不上架商品，关联2 场未开始的直播，listingtime=min（直播开始时间）
	public void Tc_ChangeNewProductInfo_016() {
		Logger.start(true,"发布一个不上架商品，关联2 场未开始的直播，listingtime=min（直播开始时间）");
		try{
		
			System.out.println(sellerId);
			//创建6天之后的直播
			Integer activityid1 = LiveCallService.createLiveBegin6dayInFuture(sellerName, sellerId).getJSONObject("Data").getInt("ActivityId");

			
			//创建8天后的直播
			Calendar c = Calendar.getInstance();
			Map<String, Object> updateMap = new HashMap<String,Object>();
			
			updateMap.put("ActivityRequest->SellerName", sellerName);
			updateMap.put("ActivityRequest->UserId", sellerId);
			updateMap.put("ActivityRequest->AppConfirmed", 1);
			updateMap.put("ActivityRequest->ActivityName", "自动化_即将开始直播");
			
			c.add(Calendar.DAY_OF_MONTH, 8);
			updateMap.put("ActivityRequest->StartTime", liveSDF.format(c.getTime()));
			c.add(Calendar.HOUR, 2);
			updateMap.put("ActivityRequest->EndTime", liveSDF.format(c.getTime()));
			
			Integer activityid2 = new CreateLiveCall().callAndGetReturnData(updateMap).getJSONObject("Data").getInt("ActivityId");
			Logger.debug(activityid1);
			Logger.debug(activityid2);
			//添加不上架的商品并加入直播
			Map<String, Object> map = new HashMap<String, Object>();
			
			List<Integer> list = new ArrayList<>();
			list.add(activityid1);
			
			map.put("UserID", sellerId);
			map.put("LoginID", sellerName);			
			map.put("Product->OnSaleType", 2);
			map.put("Product->ProductName", "hl自动化测试_定时上架商品 "+sdfForName.format(Calendar.getInstance().getTime()));
			map.put("Product->LiveIdList",new JSONArray(list));

			//获取商品ID
			String productid = SellerProductCallService.addNewProductNotOnSale(sellerId, sellerName, map).getJSONObject("Data").getString("ProductID");
			
			//获取规格ID
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productid).get(0).getsCatalogId();
			//修改商品为下架状态
			Map<String, Object> updatemap = new HashMap<String, Object>();
			updatemap.put("Product->sProductId", productid);
			updatemap.put("ProductID", productid);
			updatemap.put("LoginID", sellerName);
			updatemap.put("UserID", sellerId);
			updatemap.put("Product->OnSaleType", 2);
			updatemap.put("Product->Catalogs[0]->CatalogId",catalogid);
			
			JSONObject responbean = changenewproductinfoCall.callAndGetReturnData(updatemap);
			Logger.verifyEquals(200, responbean.getInt("Code"), "接口返回200");
			JSONObject requestbean = responbean.getJSONObject(JsonBeanHelper.JsonBeanRequest);
			//检查sql首次露出时间
			SellerProductCallService.checkSqlListingTime(productid,3);
			//检查mongo首次露出时间
			SellerProductCallService.checkListingTime(productid, null);
			
			if (YmtMongoDriverFactroy.isNewJavaMgoCheck()){
				NewJavaMongoCheckService.checkProductMgoSyncBySQL_NewJavaMgo(productid);
			}
		} catch (Exception e) {
			Logger.fail(e);
		} 
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_ChangeNewProductInfo_017() {
		Logger.start(true,"修改商品 属性 和模板");
		try{
			SaveProductTemplateCall saveProductTemplateCall = new SaveProductTemplateCall();
			saveProductTemplateCall.deleteTemplate(sellerId);
			//	模版类型（1，尺码模版 2，买家须知 3，买手服务）
			ProdTplBean sizeTemplate = saveProductTemplateCall.saveTemplate(sellerId, 1);
			ProdTplBean buyerNoticeTemplate = saveProductTemplateCall.saveTemplate(sellerId, 2);
			ProdTplBean sellerServiceTemplate = saveProductTemplateCall.saveTemplate(sellerId, 3);
			
			//get property 
			Map<String, Object> thirdCategoryAndPropertyVal = SellerProductCallService.getThirdCategoryAndPropertyValue();
			
			//发布商品
			JSONObject addProductBean = JsonBeanHelper.getJsonBean("com.ymatou.iapi.sellerproduct/AddNewSellerProduct/AddNewProductTpl.json");	
			Map<String, Object> updateMap = MapUtil.hashMap();
			updateMap.put("UserID", sellerId);
			updateMap.put("LoginID", sellerName);
			updateMap.put("Product->iThirdCategoryId", thirdCategoryAndPropertyVal.get("ThirdCategory"));
			updateMap.put("Product->PropertyList", (JSONArray)thirdCategoryAndPropertyVal.get("PropertyList"));
			updateMap.put("Product->SizeTemplateId", sizeTemplate.getTemplateId());
			updateMap.put("Product->BuyerNoticeId",buyerNoticeTemplate.getTemplateId());
			updateMap.put("Product->SellerServiceId", sellerServiceTemplate.getTemplateId());	
			JsonBeanHelper.updateJsonBean(addProductBean, updateMap);
			
			String productId = SellerProductCallService.addNewProduct(addProductBean).getJSONObject("Data").getString("ProductID");
			
			//属性检查
			SellerProductCallService.checkProdProperty(productId,(JSONArray)thirdCategoryAndPropertyVal.get("PropertyList"));
			
			//模板检查
			//check product template
			SellerProductCallService.checkTemplateWithProd(productId, Arrays.asList(sizeTemplate,buyerNoticeTemplate,sellerServiceTemplate));
			
			//====================================================================================================================================
			//修改属性和模板
			//	模版类型（1，尺码模版 2，买家须知 3，买手服务）
			ProdTplBean sizeTemplate2 = saveProductTemplateCall.saveTemplate(sellerId, 1);
			ProdTplBean buyerNoticeTemplate2 = saveProductTemplateCall.saveTemplate(sellerId, 2);
			ProdTplBean sellerServiceTemplate2 = saveProductTemplateCall.saveTemplate(sellerId, 3);
			
			Map<String, Object> thirdCategoryAndPropertyVal2 = SellerProductCallService.getThirdCategoryAndPropertyValue2();
			
			
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).get(0).getsCatalogId();
			Map<String, Object> updatemap2 = new HashMap<String, Object>();
			updatemap2.put("Product->sProductId", productId);
			updatemap2.put("ProductID", productId);
			updatemap2.put("LoginID", sellerName);
			updatemap2.put("UserID", sellerId);
			updatemap2.put("Product->Catalogs[0]->CatalogId",catalogid);
			updatemap2.put("Product->iThirdCategoryId", thirdCategoryAndPropertyVal2.get("ThirdCategory"));
			updatemap2.put("Product->PropertyList", (JSONArray)thirdCategoryAndPropertyVal2.get("PropertyList"));
			updatemap2.put("Product->SizeTemplateId", sizeTemplate2.getTemplateId());
			updatemap2.put("Product->BuyerNoticeId",buyerNoticeTemplate2.getTemplateId());
			updatemap2.put("Product->SellerServiceId", sellerServiceTemplate2.getTemplateId());	
			
			JSONObject responbean = changenewproductinfoCall.callAndGetReturnData(updatemap2);
			Logger.verifyEquals(200, responbean.getInt("Code"), "接口返回200");
			
			//属性检查
			SellerProductCallService.checkProdProperty(productId,(JSONArray)thirdCategoryAndPropertyVal2.get("PropertyList"));
			
			//模板检查
			//check product template
			SellerProductCallService.checkTemplateWithProd(productId, Arrays.asList(sizeTemplate2,buyerNoticeTemplate2,sellerServiceTemplate2));
			
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_ChangeNewProductInfo_018() {
		Logger.start(true,"修改商品 三级品类  和模板 ");
		try{
			SaveProductTemplateCall saveProductTemplateCall = new SaveProductTemplateCall();
			saveProductTemplateCall.deleteTemplate(sellerId);
			//	模版类型（1，尺码模版 2，买家须知 3，买手服务）
			ProdTplBean sizeTemplate = saveProductTemplateCall.saveTemplate(sellerId, 1);
			ProdTplBean buyerNoticeTemplate = saveProductTemplateCall.saveTemplate(sellerId, 2);
			ProdTplBean sellerServiceTemplate = saveProductTemplateCall.saveTemplate(sellerId, 3);
			
			//get property 
			Map<String, Object> thirdCategoryAndPropertyVal = SellerProductCallService.getThirdCategoryAndPropertyValue();
			
			//发布商品
			JSONObject addProductBean = JsonBeanHelper.getJsonBean("com.ymatou.iapi.sellerproduct/AddNewSellerProduct/AddNewProductTpl.json");	
			Map<String, Object> updateMap = MapUtil.hashMap();
			updateMap.put("UserID", sellerId);
			updateMap.put("LoginID", sellerName);
			updateMap.put("Product->iThirdCategoryId", thirdCategoryAndPropertyVal.get("ThirdCategory"));
			updateMap.put("Product->PropertyList", (JSONArray)thirdCategoryAndPropertyVal.get("PropertyList"));
			updateMap.put("Product->SizeTemplateId", sizeTemplate.getTemplateId());
			updateMap.put("Product->BuyerNoticeId",buyerNoticeTemplate.getTemplateId());
			updateMap.put("Product->SellerServiceId", sellerServiceTemplate.getTemplateId());	
			JsonBeanHelper.updateJsonBean(addProductBean, updateMap);
			
			String productId = SellerProductCallService.addNewProduct(addProductBean).getJSONObject("Data").getString("ProductID");
			
			//属性检查
			SellerProductCallService.checkProdProperty(productId,(JSONArray)thirdCategoryAndPropertyVal.get("PropertyList"));
			
			//模板检查
			//check product template
			SellerProductCallService.checkTemplateWithProd(productId, Arrays.asList(sizeTemplate,buyerNoticeTemplate,sellerServiceTemplate));
			
			//====================================================================================================================================
			//修改属性和模板
			//	模版类型（1，尺码模版 2，买家须知 3，买手服务）
			ProdTplBean sizeTemplate2 = saveProductTemplateCall.saveTemplate(sellerId, 1);
			ProdTplBean buyerNoticeTemplate2 = saveProductTemplateCall.saveTemplate(sellerId, 2);
			ProdTplBean sellerServiceTemplate2 = saveProductTemplateCall.saveTemplate(sellerId, 3);
			
			Map<String, Object> thirdCategoryAndPropertyVal2 = SellerProductCallService.getThirdCategoryAndPropertyValue2();
			
			
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).get(0).getsCatalogId();
			Map<String, Object> updatemap2 = new HashMap<String, Object>();
			updatemap2.put("Product->sProductId", productId);
			updatemap2.put("ProductID", productId);
			updatemap2.put("LoginID", sellerName);
			updatemap2.put("UserID", sellerId);
			updatemap2.put("Product->Catalogs[0]->CatalogId",catalogid);
			updatemap2.put("Product->iThirdCategoryId", thirdCategoryAndPropertyVal2.get("ThirdCategory"));
			//updatemap2.put("Product->PropertyList", (JSONArray)thirdCategoryAndPropertyVal2.get("PropertyList"));
			updatemap2.put("Product->SizeTemplateId", sizeTemplate2.getTemplateId());
			updatemap2.put("Product->BuyerNoticeId",buyerNoticeTemplate2.getTemplateId());
			updatemap2.put("Product->SellerServiceId", sellerServiceTemplate2.getTemplateId());	
			
			JSONObject responbean = changenewproductinfoCall.callAndGetReturnData(updatemap2);
			Logger.verifyEquals(200, responbean.getInt("Code"), "接口返回200");
			
			//属性检查
			SellerProductCallService.checkProdProperty(productId,new JSONArray());
			
			//模板检查
			//check product template
			SellerProductCallService.checkTemplateWithProd(productId, Arrays.asList(sizeTemplate2,buyerNoticeTemplate2,sellerServiceTemplate2));
			
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_ChangeNewProductInfo_019() {
		Logger.start(true,"修改商品 属性值 ");
		try{
			SaveProductTemplateCall saveProductTemplateCall = new SaveProductTemplateCall();
			saveProductTemplateCall.deleteTemplate(sellerId);
			//	模版类型（1，尺码模版 2，买家须知 3，买手服务）
			ProdTplBean sizeTemplate = saveProductTemplateCall.saveTemplate(sellerId, 1);
			ProdTplBean buyerNoticeTemplate = saveProductTemplateCall.saveTemplate(sellerId, 2);
			ProdTplBean sellerServiceTemplate = saveProductTemplateCall.saveTemplate(sellerId, 3);
			
			//get property 
			Map<String, Object> thirdCategoryAndPropertyVal = SellerProductCallService.getThirdCategoryAndPropertyValue();
			
			//发布商品
			JSONObject addProductBean = JsonBeanHelper.getJsonBean("com.ymatou.iapi.sellerproduct/AddNewSellerProduct/AddNewProductTpl.json");	
			Map<String, Object> updateMap = MapUtil.hashMap();
			updateMap.put("UserID", sellerId);
			updateMap.put("LoginID", sellerName);
			updateMap.put("Product->iThirdCategoryId", thirdCategoryAndPropertyVal.get("ThirdCategory"));
			updateMap.put("Product->PropertyList", (JSONArray)thirdCategoryAndPropertyVal.get("PropertyList"));
			updateMap.put("Product->SizeTemplateId", sizeTemplate.getTemplateId());
			updateMap.put("Product->BuyerNoticeId",buyerNoticeTemplate.getTemplateId());
			updateMap.put("Product->SellerServiceId", sellerServiceTemplate.getTemplateId());	
			JsonBeanHelper.updateJsonBean(addProductBean, updateMap);
			
			String productId = SellerProductCallService.addNewProduct(addProductBean).getJSONObject("Data").getString("ProductID");
			
			//属性检查
			SellerProductCallService.checkProdProperty(productId,(JSONArray)thirdCategoryAndPropertyVal.get("PropertyList"));

			//check product template
			SellerProductCallService.checkTemplateWithProd(productId, Arrays.asList(sizeTemplate,buyerNoticeTemplate,sellerServiceTemplate));
			
			
			//====================================================================================================================================
			Map<String, Object> thirdCategoryAndPropertyVal2 = SellerProductCallService.getThirdCategoryAndPropertyValueUpdate();
			String catalogid = new YmtCatalogsIWapper().selectCatalogsByProductId(productId).get(0).getsCatalogId();
			Map<String, Object> updatemap2 = new HashMap<String, Object>();
			updatemap2.put("Product->sProductId", productId);
			updatemap2.put("ProductID", productId);
			updatemap2.put("LoginID", sellerName);
			updatemap2.put("UserID", sellerId);
			updatemap2.put("Product->Catalogs[0]->CatalogId",catalogid);
			updatemap2.put("Product->iThirdCategoryId", thirdCategoryAndPropertyVal2.get("ThirdCategory"));
			updatemap2.put("Product->PropertyList", (JSONArray)thirdCategoryAndPropertyVal2.get("PropertyList"));
			
			
			JSONObject responbean = changenewproductinfoCall.callAndGetReturnData(updatemap2);
			Logger.verifyEquals(200, responbean.getInt("Code"), "接口返回200");
			
			//属性检查
			SellerProductCallService.checkProdProperty(productId,(JSONArray)thirdCategoryAndPropertyVal2.get("PropertyList"));
			

			//SellerProductCallService.checkTemplateWithProd(productId, new ArrayList<ProdTplBean>());
			
			
			
		}catch(Exception e){
			Logger.fail(e);
		}
	}
	
}